Most cameras, including digital cameras, have an automatic focus feature in which scenes viewed through the camera can be focused automatically. Modern cameras implement auto focusing by measuring several areas of the scene and by determining where in the scene (or in which measured area) the scene's subject is located. Auto focus systems are generally categorized as either active or passive systems. Active systems actually determine the distance between the camera and the subject of the scene by measuring the total travel time of ultrasonic waves or infrared light emitted from the camera. Based on the total travel time, the distance between the camera and the subject of the scene may be calculated and the appropriate lens position may be selected. Passive auto focus systems, on the other hand, do not require the emission of ultrasonic waves or infrared light, but instead simply rely on the light that is naturally reflected by the subject in the scene.
One example of a passive auto focus system is an auto focus system that utilizes contrast measurement to determine the best focal position. In a contrast measurement auto focus system, adjacent areas of a scene are compared with each other. Specifically, the camera measures any differences in intensity among the adjacent areas of the scene. An out-of-focus scene will include adjacent areas that have similar intensities. A focused scene will likely show a significant contrast between areas in which the subject of the scene is located and other areas of the scene. As the camera incrementally moves the auto focus lens, each area of the scene is analyzed to determine any differences in intensity between adjacent areas. When a lens position is found that results in the maximum intensity difference between adjacent areas, the camera will use the found lens position for its auto focus setting.
One problem that arises when using the contrast measurement auto focus method, as described above, is how to handle a scene that has multiple subjects that are of varying distances from the camera. In such a situation, finding the best lens focal position is more challenging. For example, in a scene that includes two subjects, the contrast measurement auto focus method may correctly identify the presence of the two subjects as indicated by the existence of multiple regions of high intensity differences, but the contrast measurement auto focus method may be unable to resolve which of the two subjects should be selected for determination of a best lens focal position. Many conventional contrast measurement auto focus methods account for this situation by determining a sharpness score for each pair of adjacent scene areas, and then determining an average sharpness score for an entire frame or camera window. However, the conventional methods often fail to produce the best results for a scene with two or more objects that are different distances from the camera. Many times, the lens position resulting in the maximum average sharpness for the scene does not result in either of the two objects being in focus.
One solution to the problem described above is explained in U.S. patent application Ser. No. 11/176,284, filed on Jul. 8, 2005, hereby incorporated by reference in its entirety. The '284 application describes a method in which the imaged scene is divided into a two-dimensional array of zones. For each of a plurality of lens positions, the maximum sharpness score for each zone is determined. Then, a histogram is generated, showing each lens position with its corresponding combined maximum sharpness score for the zones. The lens position with the highest peak on the histogram is determined to be the best focus position for the given scene. Thus, instead of averaging over all possible lens positions, only the lens position associated with the highest overall sharpness score is used.
Although the method described in the '284 application is a clear improvement over the conventional methods, as described above, the method of the '284 application can be improved upon. Specifically, there is a need and a desire for a method of auto focusing a camera and its lens in low light or high noise conditions.